<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="修改临牌" bodyClass="white-bg" />
<div class="wrapper wrapper-content ibox-content">
    <@form.form id="form-temptag-edit"  class="form-horizontal">
    <input name="id" value="${bpmCrmTemptag.id}" type="hidden">
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "销售员"/>：
            <i class="fa fa-question-circle-o" title="销售员"></i>
        </label>
        <div class="col-sm-8">
            <input name="saleUserid" class="form-control" type="text" value="${bpmCrmTemptag.saleUserid?default("")}" required readonly="true">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "销售订单编号" />：                               <i class="fa fa-question-circle-o" title="销售订单编号"></i>                                
       </label>
        <div class="col-sm-8"><input name="saleOrderNumber" value="${bpmCrmTemptag.saleOrderNumber?default("")}" class="form-control" type="text"  required readonly="true">
        </div>
     </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "车辆识别号" />：                               <i class="fa fa-question-circle-o" title="车辆识别号"></i>                                
       </label>
        <div class="col-sm-8"><input name="outCarVin" value="${bpmCrmTemptag.outCarVin?default("")}" class="form-control" type="text"  required readonly="true">
        </div>
     </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "车型" />：                               <i class="fa fa-question-circle-o" title="车型"></i>                                
       </label>
        <div class="col-sm-8"><input name="outCarVehicle" value="${bpmCrmTemptag.outCarVehicle?default("")}" class="form-control" type="text"  required readonly="true">
        </div>
     </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "注册人姓名" />：                               <i class="fa fa-question-circle-o" title="注册人姓名"></i>                                
       </label>
        <div class="col-sm-8"><input name="orderRegistrantName" value="${bpmCrmTemptag.orderRegistrantName?default("")}" class="form-control" type="text"  required>                                                
        </div>
     </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "注册人地址" />：                               <i class="fa fa-question-circle-o" title="注册人地址"></i>                                
       </label>
        <div class="col-sm-8"><input name="orderRegistrantAddress" value="${bpmCrmTemptag.orderRegistrantAddress?default("")}" class="form-control" type="text"  required>                                                
        </div>
     </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "注册人手机" />：                               <i class="fa fa-question-circle-o" title="注册人手机"></i>                                
       </label>
        <div class="col-sm-8"><input name="orderRegistrantPhone" value="${bpmCrmTemptag.orderRegistrantPhone?default("")}" class="form-control" type="text"  required>                                                
        </div>
     </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "是否需要邮件"/>：</label>
        <div class="col-sm-8">
           <@form.radio name="orderIsNeedMail" dictType="sys_crm_isOrNo" value="${bpmCrmTemptag.orderIsNeedMail?default('')}" />
        </div>

    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "收件人是否同注册人"/>：</label>
        <div class="col-sm-8">
           <@form.radio name="orderRecipientisregistrant" dictType="sys_crm_isOrNo" value="${bpmCrmTemptag.orderRecipientisregistrant?default('')}" />
        </div>

    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "收件人姓名" />：
       </label>
        <div class="col-sm-8"><input name="orderRecipientName" value="${bpmCrmTemptag.orderRecipientName?default("")}" class="form-control" type="text" required>
        </div>
     </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "收件人地址" />：
       </label>
        <div class="col-sm-8"><input name="orderRecipientAddress" value="${bpmCrmTemptag.orderRecipientAddress?default("")}" class="form-control" type="text" required>
        </div>
     </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "收件人手机" />：
       </label>
        <div class="col-sm-8"><input name="orderRecipientPhone" value="${bpmCrmTemptag.orderRecipientPhone?default("")}" class="form-control" type="text" required>
        </div>
     </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "邮件备注"/>：</label>
        <div class="col-sm-8">
            <textarea name="orderRecipientMailMemo" class="form-control" required>${bpmCrmTemptag.orderRecipientMailMemo?default("")}</textarea>
        </div>
    </div>



    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "选择临时号牌" />：                               <i class="fa fa-question-circle-o" title="从临牌库存里选择  （过滤条件-库存状态=已入库）"></i>                                
       </label>
        <div class="col-sm-8"><input name="selectTempTagNumber" value="${bpmCrmTemptag.selectTempTagNumber?default("")}" class="form-control" type="text"  required <#if bpmCrmTemptag.orderRecipientMailMemo ==1 >readonly="true"</#if>>
        </div>
     </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "发货信息" />：                               <i class="fa fa-question-circle-o" title="发货信息"></i>                                
       </label>
        <div class="col-sm-8"><input name="shippingInfo" value="${bpmCrmTemptag.shippingInfo?default("")}" class="form-control" type="text"  required>                                                
        </div>
     </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "运费" />：                               <i class="fa fa-question-circle-o" title="运费"></i>                                
       </label>
        <div class="col-sm-8"><input name="shippingFee" value="${bpmCrmTemptag.shippingFee?default("")}" class="form-control" type="text"  required>                                                
        </div>
     </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "临牌费" />：                               <i class="fa fa-question-circle-o" title="临牌费  （默认值=15）"></i>                                
       </label>
        <div class="col-sm-8"><input name="tempTagFee" value="${bpmCrmTemptag.tempTagFee?default("")}" class="form-control" type="text"  required>                                                
        </div>
     </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "总费用" />：                               <i class="fa fa-question-circle-o" title="总费用    公式：SUM(Temp tag fee,Shipping fee)"></i>                                
       </label>
        <div class="col-sm-8"><input name="totalFee" value="${bpmCrmTemptag.totalFee?default("")}" class="form-control" type="text"  required>                                                
        </div>
     </div>
</@form.form>
<@footer>
<script type="text/javascript">
    $(function () {
    })
    var prefix = baseURL + "bpm/temptag";
    $("#form-temptag-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        var entryInfo=$('#form-temptag-edit').serialize();
        console.log("编辑替换之前的字符串为",entryInfo)
        var entryString='';
        var newString=entryInfo.replace("orderIsNeedMail=Y","orderIsNeedMail=1");
        newString=newString.replace("orderIsNeedMail=N","orderIsNeedMail=0");
        newString=newString.replace("orderRecipientisregistrant=Y","orderRecipientisregistrant=1");
        newString=newString.replace("orderRecipientisregistrant=N","orderRecipientisregistrant=0");
        console.log("编辑替换之后的字符串为",newString)
        if (opt.validate.form()) {
            opt.operate.save(prefix + "/edit", newString);
        }
    }

    /**
     * redio 单选回调
     * @param id
     * @param data
     * @param event
     */
    function  redioCallback(id,data,event){
        if(id == "orderIsNeedMail"){
            if ($(data).is(':checked')){
                var menuType = $(event.target).val();
                if(menuType=="1"){
                    $(".isNeedMail").show();
                    if($("[name='orderRecipientisregistrant']")[0].checked){
                        $(".different").hide();
                    }
                    else{
                        $(".different").show();
                    }
                }
                else{
                    $(".different").hide();
                    $(".isNeedMail").hide();
                }
            }
        }
        else if(id=="orderRecipientisregistrant"){
            if ($(data).is(':checked')){
                var menuType = $(event.target).val();
                if(menuType=="1"){
                    $(".different").hide();
                }
                else{
                    $(".different").show();
                }
            }
        }
    }

</script>
</@footer>
</@pageTheme>
